<% add_decidim_page_title(t(".title")) %>
<div class="card">
  <div class="item_show__header item_show__header--with-action-options">
    <h1 class="item_show__header-title">
      <div>
        <%= t(".title") %>
        <span id="js-selected-proposals-count" class="component-counter " title="<%= t("decidim.proposals.admin.proposals.index.selected") %>"></span>
      </div>
      <div class="flex items-center gap-x-4">
        <%= render partial: "bulk-actions" %>
        <%= link_to t(".statuses"), proposal_states_path, class: "button button__sm button__transparent-secondary" %>

        <% if allowed_to? :create, :proposal %>
          <%= link_to t("actions.new", scope: "decidim.proposals"), new_proposal_path, class: "button button__sm button__secondary" %>
        <% end %>
        <%= render partial: "decidim/admin/components/resource_action" %>
      </div>
    </h1>

    <%= render partial: "decidim/proposals/admin/proposals/bulk_actions/taxonomy_change" %>
    <%= render partial: "decidim/proposals/admin/proposals/bulk_actions/assign_to_evaluator" %>
    <%= render partial: "decidim/proposals/admin/proposals/bulk_actions/unassign_from_evaluator" %>
  </div>
  <%= admin_filter_selector(filter_prefix_key) %>

  <% if component_settings.collaborative_drafts_enabled? %>
    <div class="flash warning"><%= t("deprecation_warning_collaborative_drafts_html", scope: "decidim.proposals.admin") %></div>
  <% end %>

  <div class="table-stacked mt-8">
    <table class="table-list">
      <%= render partial: "proposals-thead" %>
      <tbody>
        <%= render partial: "decidim/proposals/admin/proposals/proposal-tr",
                   collection: proposals,
                   as: :proposal,
                   locals: { view: :index } %>
      </tbody>
    </table>
  </div>
  <% if allowed_to? :manage_trash, :proposal, participatory_space: current_participatory_space %>
    <div class="card mt-4">
      <%= link_to manage_trash_proposals_path, class: "flex items-center  text-secondary" do %>
        <%= icon "delete-bin-2-line", class: "mr-2 fill-current text-secondary", role: "img" %>
        <%= t("actions.view_deleted_proposals", scope: "decidim.proposals.admin") %>
        <span class="ml-2">
          <%= icon_with_tooltip("information-line", t("actions.deleted_proposals_info", scope: "decidim.proposals.admin")) %>
        </span>
      <% end %>
    </div>
  <% end %>
</div>

<%= decidim_paginate proposals %>

<%= append_javascript_pack_tag "decidim_proposals_admin" %>
